//
//  Define.h
//  DemoV2
// 一些辅助宏定义，TODO: 接入Config，添加一些配置宏
//  Created by 董一龙 on 2022/6/25.
//

#ifndef Define_h
#define Define_h

#import <Foundation/Foundation.h>

/**
 UI尺寸
 */
// 获取屏幕宽度与高度
#define SCREEN_WIDTH   [UIScreen mainScreen].bounds.size.width
#define SCREENH_HEIGHT [UIScreen mainScreen].bounds.size.height
#define SCREEN_SIZE [UIScreen mainScreen].bounds.size
// 状态栏高度
#define kStatusBarHeight        44.f
// 顶部导航栏高度
#define kNavigationBarHeight    44.f
// 顶部安全距离
#define kSafeAreaTopHeight      88.f
// 底部安全距离
#define kSafeAreaBottomHeight   34.f
// Tabbar高度
#define kTabbarHeight           49.f
// 去除上下导航栏剩余中间视图高度
#define kContentHeight           (SCREENH_HEIGHT - kSafeAreaTopHeight - kSafeAreaBottomHeight - kTabbarHeight)


/**
 颜色
 */
// 随机颜色
#define MMRandomColor [UIColor colorWithRed:arc4random_uniform(256)/255.0 green:arc4random_uniform(256)/255.0 blue:arc4random_uniform(256)/255.0 alpha:1.0]
#define MMRGBColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]
#define MMRGBAColor(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(r)/255.0 blue:(r)/255.0 alpha:a]// clear背景颜色
#define MMClearColor [UIColor clearColor]


/**
 设置view圆角与边界
 */
#define MMViewBorderRadius(View, Radius, Width, Color)\
\
[View.layer setCornerRadius:(Radius)];\
[View.layer setMasksToBounds:YES];\
[View.layer setBorderWidth:(Width)];\
[View.layer setBorderColor:[Color CGColor]]

/**
 debug日志
 */
#ifdef DEBUG
    #define LOGONTEST(...) NSLog(@"func=%s line=%d %@\n",__func__,__LINE__,[NSString stringWithFormat:__VA_ARGS__])
#else
    #define LOGONTEST(...)
#endif

/**
 数学工具
 */
// 角度转换弧度
#define MMDegreesToRadian(x) (M_PI * (x) / 180.0)
// 弧度转换角度
#define MMRadianToDegrees(radian) (radian*180.0)/(M_PI)

// TODO: 配置图片路径
#define kGetImage(imageName) [UIImage imageNamed:[NSString stringWithFormat:@"%@",imageName]]

#define NSStringFormat(format,...) [NSString stringWithFormat:format,##__VA_ARGS__]

#endif /* Define_h */
